diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-17 18:37:38 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-17 18:37:38 +0200 |
| commit | 7d9f874364ec6e255e62eb3027011bfed267904c (patch) | |
| tree | 711e3ce9fba99abdff89016f15b9bc763d61f03f /src/pages/article/[slug].tsx | |
| parent | 9a186b357b32325cf77fdce39a6c6c9aff76d8a5 (diff) | |
chore: adjust articles styles
* change animation on article card hover
* change comments section alignment
Diffstat (limited to 'src/pages/article/[slug].tsx')
| -rw-r--r-- | src/pages/article/[slug].tsx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/pages/article/[slug].tsx b/src/pages/article/[slug].tsx index 995e3a9..a0fb7fc 100644 --- a/src/pages/article/[slug].tsx +++ b/src/pages/article/[slug].tsx @@ -15,7 +15,10 @@ import { type Article, type Comment } from '@ts/types/app'; import { loadTranslation, type Messages } from '@utils/helpers/i18n'; import useAddPrismClassAttr from '@utils/hooks/use-add-prism-class-attr'; import useBreadcrumb from '@utils/hooks/use-breadcrumb'; -import usePrismPlugins, { PrismPlugin } from '@utils/hooks/use-prism-plugins'; +import usePrismPlugins, { + type PrismPlugin, +} from '@utils/hooks/use-prism-plugins'; +import useReadingTime from '@utils/hooks/use-reading-time'; import useSettings from '@utils/hooks/use-settings'; import { GetStaticPaths, GetStaticProps, NextPage } from 'next'; import Head from 'next/head'; @@ -38,7 +41,16 @@ type ArticlePageProps = { */ const ArticlePage: NextPage<ArticlePageProps> = ({ comments, post }) => { const { content, id, intro, meta, slug, title } = post; - const { author, commentsCount, cover, dates, seo, thematics, topics } = meta; + const { + author, + commentsCount, + cover, + dates, + seo, + thematics, + topics, + wordsCount, + } = meta; const { data } = useSWR(() => id, getPostComments, { fallbackData: comments, }); @@ -46,11 +58,13 @@ const ArticlePage: NextPage<ArticlePageProps> = ({ comments, post }) => { title, url: `/article/${slug}`, }); + const readingTime = useReadingTime(wordsCount || 0, true); const headerMeta: PageLayoutProps['headerMeta'] = { author: author?.name, publication: { date: dates.publication }, update: dates.update ? { date: dates.update } : undefined, + readingTime, thematics: thematics && thematics.map((thematic) => ( |
